package com.rd.student.jike.class2.xuezhixin.day0802;

import java.util.Scanner;

public class Store {
    static String instance;

    public static Animal getInstance(){
        Animal animal;
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("选择的宠物：");
            instance = scanner.next();
            switch (instance) {
                case "dog":
                    Dog dog = new Dog("小汪","白色");
                    animal = dog;
                    //animal.voice();
                    return animal;
                case "pig":
                    Pig pig = new Pig("小哼");
                    animal = pig;
                    //animal.voice();
                    return animal;
                case "cat":
                    Cat cat = new Cat("小喵","蓝色");
                    animal = cat;
                    //animal.voice();
                    return animal;
                default:
                    System.out.println("暂时没有这个宠物");
                    break;
            }
        }
    }
}
